package com.plsjavaweb.dao.mapper;

import java.sql.ResultSet;
import java.sql.SQLException;

import java.util.List;

import org.apache.log4j.Logger;

import com.plsjavaweb.dao.DAOFactory;
import com.plsjavaweb.logging.LoggingConstants;
import com.plsjavaweb.pojo.AccountPOJO;


public class AccountMapper implements Mapper<AccountPOJO>{
	Logger log= Logger.getLogger(DAOFactory.class);
	
	@Override
	public List<AccountPOJO> MapList(ResultSet rs) throws SQLException {
		log.info(LoggingConstants.entryMessage);
		log.info(LoggingConstants.returnedMessage);	
		log.info("null return");	
		
		return null;
	}

	@Override
	public AccountPOJO MapObject(ResultSet rs) throws SQLException {
		log.info(LoggingConstants.entryMessage);
		
		AccountPOJO account = null;
		while(rs.next())
		{
			account = new AccountPOJO();
			account.setEmployeeId(rs.getInt("employee_id"));
			account.setPassword(rs.getString("password"));
			account.setUsername(rs.getString("username"));
			account.setRole(rs.getString("role"));
		}
		
		log.info(LoggingConstants.returnedMessage);	
		return account;
	}

}
